import { request } from './request'

export function getDetail(iid) {
    return request({
        url: '/detail',
        params: {
            iid
        }
    })
}
export function recommend(iid) {
    return request({
        url: '/recommend',
        params: {
            iid
        }
    })
}
export class GoodsInfo {
    constructor(itemInfo, columns, services) {
        //拿的商品Info的信息
        this.title = itemInfo.title,
            this.desc = itemInfo.desc,
            this.discountBgColor = itemInfo.discountBgColor,
            this.discount = itemInfo.discountDesc,
            this.newPrice = itemInfo.price,
            this.oldPrice = itemInfo.oldPrice,
            this.realPrice = itemInfo.lowNowPrice,
            //销量、收藏、默认快递等信息
            this.columns = columns,
            //7天无理由退货、退货补运费、全国包邮、72小时发货等信息
            this.services = services

    }
}

export class Shop {
    constructor(shopInfo) {
        this.logo = shopInfo.shopLogo,
            this.name = shopInfo.name,
            this.fans = shopInfo.cFans,
            this.sells = shopInfo.cSells,
            this.goodsCount = shopInfo.cGoods,
            this.score = shopInfo.score

    }
}

export class GoodsParam {
    constructor(info, rule) {
        this.image = info.images ? info.images : "";
        this.infos = info.set;
        this.sizes = rule.tables;
    }
}